package com.boot.stream;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.context.annotation.Primary;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.listener.MessageListener;
import org.springframework.stereotype.Component;

@Component
@Primary
@Slf4j
public class StreamsResultListener implements MessageListener<String, String> {

    @KafkaListener(topics = {"steams-res"},
            containerFactory = "kafkaListenerContainerFactory",
            id = "containerFactory")
    @Override
    public void onMessage(ConsumerRecord<String, String> data) {
        log.info("recieve value=" + data.value() + ",key=" + data.key());
    }
}
